package com.gxgeek.javabasic.collection;

import lombok.Data;
import lombok.extern.slf4j.Slf4j;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.ListIterator;

@Slf4j
@Data
public class A {

    private transient String pwd;
    private  String name;

    public A() {

    }

    public static void main(String[] args) {
//        A a  = new A();
//       a.setName("gx");
//       a.setPwd("123");
//        log.info(JSON.toJSONString(a));

        ArrayList list = new ArrayList(Arrays.asList("11","22","33","24"));


//        Iterator  iterator = list.iterator();
//        while (iterator.hasNext()){
//            String s= (String) iterator.next();
//
//
//
//        }
        ListIterator listIterator = list.listIterator();
        while (listIterator.hasNext()){
            String object = (String)listIterator.next();
            if (object.startsWith("2")){
                log.info(object.substring(object.indexOf("2")+1));
                listIterator.set(object.substring(object.indexOf("2")+1));
//                listIterator.remove();
//                log.info(String.valueOf(list));
            };
        }
        log.info(String.valueOf(list));
    }
}
